
export default function(url) {
    // 创建socket
    let websocket = null;
    let clientId = Math.random().toString(36).substr(2);

//判断当前浏览器是否支持WebSocket
    if ('WebSocket' in window) {
        //连接WebSocket节点
        websocket = new WebSocket(url);
    } else {
        console.log("当前浏览器不支持WebSocket")
    }

    return {
        websocket
    }
}
